package com.zisu.springbootsource;

import com.zisu.springbootsource.initializer.SecondInitializer;
import com.zisu.springbootsource.listener.SecondListener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.test.context.ContextConfiguration;

@SpringBootApplication
public class SpringbootsourceApplication {
//系统初始化类 如何被springboot 容器识别 并注入进去 === 是通过SpringFactoriesLoader 这个类实现的。

    public static void main(String[] args) {
        //ioc 部分



        //FirstInitializer way1   这种方式 只初始化 run FirstInitializer
        /*SpringApplication.run(SpringbootsourceApplication.class, args);*/

        //SecondInitializer way2   这种方式 初始化  FirstInitializer、SecondInitializer
        SpringApplication springApplication = new SpringApplication(SpringbootsourceApplication.class);
        springApplication.addInitializers(new SecondInitializer());
        springApplication.addListeners(new SecondListener());
        springApplication.run(args);

    }

}
